package xu.jiang.report.dealer.layer;

import xu.jiang.report.Param;

public abstract class AbstractIndexLayer<E extends IData> implements ILayerDealer<E> {
	private final int index;//层的序号
	public Param param;
	
	
	public AbstractIndexLayer(int index, Param param) {
		this.index = index;
		this.param = param;

	}


	/**
	 * 层索引
	 */
	@Override
	public int getIndex(){
		return this.index;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + this.getIndex();
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		AbstractIndexLayer other = (AbstractIndexLayer) obj;
		if (this.getIndex() != other.getIndex()) {
			return false;
		}
		
		return true;
	}
	@Override
	public int compareTo(ILayerDealer o) {
		if(this.getIndex()>o.getIndex()){
			return 1;
		}else if(this.getIndex()==o.getIndex()){
			return 0;
		}
		return -1;
	}

}
